﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpLearn
{
    class Class1
    {
        private static void A34()
        {
            Console.WriteLine("请输入一行整数，中间用空格隔开");
            while (true)
            {
                String words = Console.ReadLine();
                if (words.Length == 0)
                {
                    return;
                }
                if (words.Contains('.'))
                {
                    Console.WriteLine("请输入整数，不能输入小数，请重新输入");
                    continue;
                }
                else
                {
                    String[] numbers1 = words.Split(' ');
                    int[] num1 = new int[numbers1.Length];
                    for (int i = 0; i < numbers1.Length; i++)
                    {
                        int.TryParse(numbers1[i], out (num1[i]));
                    }
                    Array.Sort(num1);
                    for (int i = 0; i < num1.Length; i++)
                    {
                        Console.Write(num1[i] + " ");
                    }

                    Console.WriteLine();
                    Array.Reverse(num1);
                    for (int i = 0; i < num1.Length; i++)
                    {
                        Console.Write(num1[i] + " ");
                    }
                    Console.WriteLine();
                    Console.Write("平均值");
                    /*Console.WriteLine(string.Format("{0:F1}", (num1.Sum() / num1.Length)));*/
                    Console.WriteLine((num1.Sum() / num1.Length).ToString("F1"));
                    Console.WriteLine("最大值" + num1.Max());
                    Console.WriteLine("最小值" + num1.Min());
                    break;
                }

            }
        }

    }
}
